﻿<?xml version="1.0" encoding="utf-8" ?>
<Recipe xmlns="http://schemas.microsoft.com/pag/gax-core" xmlns:xi="http://www.w3.org/2001/XInclude">
	<HostData>
		<CommandBar Menu="EnterpriseLibraryProjectMenu"/>
		<CommandBar Menu="EnterpriseLibraryFolder"/>
	</HostData>
	<Arguments>
		<Argument Name="NodeName" >
			<Converter Type="CodeIdentifierStringConverter"/>
		</Argument>
		<Argument Name="PropertiesInfo" Type="System.Collections.IList, mscorlib">
			<ValueProvider  Type="Microsoft.Practices.EnterpriseLibrary.BlockFactory.ValueProviders.DesignTimePropertiesValueProvider, Microsoft.Practices.EnterpriseLibrary.BlockFactory"
                      ExcludeProperties="Name,Type,TypeName"
                      ConfigurationAttribute="ConfigurationProperty"
                     >
				<MonitorArgument Name="RuntimeConfigurationItem" />
			</ValueProvider>
		</Argument>
		<Argument Name="CurrentProject" Type="Project">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.FirstSelectedProject, Microsoft.Practices.RecipeFramework.Library" />
		</Argument>
		<xi:include href="CommonTextTemplate.xml"
		xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(gax:Recipe/gax:Arguments/gax:Argument)" />
		<Argument Name="DesignProject" Type="Project">
			<ValueProvider Type="Microsoft.Practices.RecipeFramework.Library.ValueProviders.FirstSelectedProject, Microsoft.Practices.RecipeFramework.Library" />
		</Argument>
		<Argument Name="Namespace">
			<Converter Type="Microsoft.Practices.RecipeFramework.Library.Converters.NamespaceStringConverter, Microsoft.Practices.RecipeFramework.Library"/>
			<ValueProvider Type="Evaluator"  Expression="$(DesignProject.Properties.Item('DefaultNamespace').Value)" >
				<MonitorArgument Name="DesignProject" />
			</ValueProvider>
		</Argument>
		<Argument Name="RuntimeConfigurationItem" Type="System.Type">
		</Argument>
		<Argument Name="Resources" Type="ProjectItem">
			<ValueProvider Type="ProjectItemByFullNameProvider" 
                     ProjectArgumentName="DesignProject" 
                     ItemFullName="Resources.resx"
                     />
		</Argument>
		<Argument Name="Registrar" Type="ProjectItem">
			<ValueProvider Type="ProjectItemByFullNameProvider" 
                     ProjectArgumentName="DesignProject" 
                     ItemFullName="CommandRegistrar.$LanguageFileExtension$"
                     />
		</Argument>
		<Argument Name="MapRegistrar" Type="ProjectItem">
			<ValueProvider Type="ProjectItemByFullNameProvider" 
                     ProjectArgumentName="DesignProject" 
                     ItemFullName="NodeMapRegistrar.$LanguageFileExtension$"
                     />
		</Argument>
	</Arguments>
	<Actions>
    <Action Name="AddResources" Type="Microsoft.Practices.EnterpriseLibrary.BlockFactory.Actions.EnterpriseLibrary.AddResourcesFromDesignTimeNodeInfo, Microsoft.Practices.EnterpriseLibrary.BlockFactory"
            DescriptionSuffix="Description">
      <Input Name="NodeInfo" ActionOutput="CreateDesignTimeNodeInfo.DesignTimeNodeInfo"/>
      <Input Name="Resources" RecipeArgument="Resources"/>
    </Action>
    <Action Name="AddNodeNameResource" Type="AddResource"  
						ResourceName="$NodeName$Name" 
						ResourceValue="$NodeName$"
            RunCustomTool="true"
            >
      <Input Name="Resources" RecipeArgument="Resources" />
    </Action>
    <Action Name="GenerateNodeContent" 
       Type="TextTemplateAction"
       Template="$TextTemplateBaseDirectory$DesignTimeNode.t4">
			<Input Name="DesignTimeNodeInfo" ActionOutput="CreateDesignTimeNodeInfo.DesignTimeNodeInfo"/>
			<Output Name="Content" />
		</Action>
		<Action Name="AddNode" 
			  Type="AddItemFromStringActionPromptingExistence" 
			  Open="true"  PromptForOverwriting="true" 
				TargetFileName="$NodeName$.$LanguageFileExtension$"
				>
			<Input Name="Content" ActionOutput="GenerateNodeContent.Content" />
			<Input Name="Project" RecipeArgument="DesignProject" />
			<Output Name="ProjectItem"/>
		</Action>
		<Action Name="GenerateRegistrarRegisterContent" 
	 Type="TextTemplateAction"
	 Template="$TextTemplateBaseDirectory$RegistrarRegister.t4">
			<Input Name="DesignTimeNodeInfo" ActionOutput="CreateDesignTimeNodeInfo.DesignTimeNodeInfo"/>
			<Output Name="Content" />
		</Action>
		<Action Name="GenerateMapRegistrarRegisterContent" 
       Type="TextTemplateAction"
       Template="$TextTemplateBaseDirectory$MapRegistrarRegister.t4">
			<Input Name="DesignTimeNodeInfo" ActionOutput="CreateDesignTimeNodeInfo.DesignTimeNodeInfo"/>
			<Output Name="Content" />
		</Action>
		<Action Name="GenerateRegistrarMethodsContent" 
       Type="TextTemplateAction"
       Template="$TextTemplateBaseDirectory$RegistrarMethods.t4">
			<Input Name="DesignTimeNodeInfo" ActionOutput="CreateDesignTimeNodeInfo.DesignTimeNodeInfo"/>
			<Output Name="Content" />
		</Action>
		<Action Name="AddRegistrarMethods" Type="AddItemFromStringActionPromptingExistence" PromptForOverwriting="true" ItemName="CommandRegistrar.$LanguageFileExtension$"
						TargetFileName="CommandRegistrar.$NodeName$.$LanguageFileExtension$"	>
			<Input	Name="Content" ActionOutput="GenerateRegistrarMethodsContent.Content" />
			<Input	Name="Project" RecipeArgument="DesignProject" />
			<Output Name="ProjectItem"/>
			<Output Name="CancelByTheUser"/>
		</Action>
		<Action Name="UpdateRegistrar" Type="Microsoft.Practices.EnterpriseLibrary.BlockFactory.Actions.EnterpriseLibrary.UpdateRegistrar, Microsoft.Practices.EnterpriseLibrary.BlockFactory" MethodName="Register">
			<Input Name="DesignTimeNodeInfo" ActionOutput="CreateDesignTimeNodeInfo.DesignTimeNodeInfo"/>
			<Input Name="ProjectItem"			RecipeArgument="Registrar"/>
			<Input Name="MethodContent" ActionOutput="GenerateRegistrarRegisterContent.Content"/>
			<Input Name="CancelByTheUser" ActionOutput="AddRegistrarMethods.CancelByTheUser"/>
		</Action>
		<Action Name="UpdateMapRegistrar" Type="Microsoft.Practices.EnterpriseLibrary.BlockFactory.Actions.EnterpriseLibrary.UpdateRegistrar, Microsoft.Practices.EnterpriseLibrary.BlockFactory" MethodName="Register">
			<Input Name="DesignTimeNodeInfo" ActionOutput="CreateDesignTimeNodeInfo.DesignTimeNodeInfo"/>
			<Input Name="ProjectItem"			RecipeArgument="MapRegistrar"/>
			<Input Name="MethodContent" ActionOutput="GenerateMapRegistrarRegisterContent.Content"/>
			<Input Name="CancelByTheUser" ActionOutput="AddRegistrarMethods.CancelByTheUser"/>
		</Action>
		<xi:include href="CommonTodoComments.xml"
				xpointer="xmlns(gax=http://schemas.microsoft.com/pag/gax-core) xpointer(/gax:Recipe/gax:Actions/gax:Action)" />
	</Actions>
</Recipe>